/*
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Library General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
*/

#ifndef __STYLEMODEL_H__
#define __STYLEMODEL_H__

#include <QObject>
#include <QColor>
#include <QListWidget>
#include <QComboBox>

enum Alignment {styleLeft, styleCenter, styleRight, styleJustify};

class StyleItem : private QObject
{
	Q_OBJECT
public:
	StyleItem(QString name, QString font, QString size);
	StyleItem(QString name, QString font, QString size, int red, int green, int blue, bool bold, bool italic, bool underline, int alignment, bool selected);
	
	QString styleName;
	QString styleFont;
	QString styleSize;
	QColor styleColor;
	bool styleBold;
	bool styleItalic;
	bool styleUnderline;
	int styleAlignment;
	bool styleSelected;
};

class StyleManager : public QObject
{
	Q_OBJECT
public:
	StyleManager();
	~StyleManager();
	
	int getStyleCount();
	QString getStyleName(int index);	
	
	QString getStyleFont(int index);
	QString getStyleSize(int index);
	QColor getStyleColor(int index);
	bool getStyleBold(int index);
	bool getStyleItalic(int index);
	bool getStyleUnderline(int index);
	int getStyleAlignment(int index);
	bool isStyleSelected(int index);
	
	int getStyleIndexByName(QString name);
	
	void setStyleFont(int index, QString font);
	void setStyleSize(int index, QString size);
	void setStyleColor(int index, QColor color);
	void setStyleBold(int index, bool bold);
	void setStyleItalic(int index, bool italic);
	void setStyleUnderline(int index, bool underline);
	void setStyleAlignment(int index, int alignment);
	void setStyleSelected(int index, bool value);
	
	bool doStyleExists(QString name);
	
	int addStyle(QString name, QString font, QString size);
	
	void updateModelWithCurrentList(QListWidget *list);	
	
	//void updateComboStyle(QComboBox *comboStyle);

private:
	QList<StyleItem *> *styleList;
	
	void readStyles();	
	void saveStyles();			
};

#endif // __STYLEMODEL_H__
